#! /bin/sh

ROOT=`dirname "$0"`
WEB=/var/www/default/tralyzr
export TZ='Asia/Shanghai'
DATE=`eval date +%Y%m%d_%H`
YEAR=`eval date +%Y`
MONTH=`eval date +%m`
DAY=`eval date +%d`
HOUR=`eval date +%H`

PREFIX=${WEB}/${DATE}_
WEBPREFIX=/${DATE}_

cd ${ROOT}

rm ${ROOT}/data/*
rm ${ROOT}/*.png
${ROOT}/traceip.py
${ROOT}/parseip.py
gnuplot *.g
cp delays.png ${PREFIX}delays.png
cp province_delay.png ${PREFIX}province_delay.png

echo "${YEAR}年${MONTH}月${DAY}日${HOUR}时: " >> ${WEB}/index.html
cat avgstd.dat >> ${WEB}/index.html
echo ", <a href='${WEBPREFIX}delays.png'>延迟分布</a> " >> ${WEB}/index.html
echo "<a href='${WEBPREFIX}province_delay.png'>各省分布</a>" >> ${WEB}/index.html
echo "<br>" >> ${WEB}/index.html

